import 'package:flutter/material.dart';
import 'package:netwrok_log/errorLog/error_log_page.dart';
import 'package:netwrok_log/errorLog/network_log_page.dart';

class LogPage extends StatefulWidget {
  const LogPage({Key? key}) : super(key: key);

  @override
  _LogPageState createState() => _LogPageState();
}

class _LogPageState extends State<LogPage> {
  // ignore: non_constant_identifier_names
  Widget _netWorkPage = NetworkLogPage();
  Widget _errorPage = ErrorLogPage();
  int selectedIndex = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: selectedIndex == 0 ? _netWorkPage : _errorPage,
      bottomNavigationBar: BottomAppBar(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            IconButton(
                icon: Icon(Icons.network_check,
                    color: selectedIndex == 0 ? Colors.red : Colors.black),
                onPressed: () {
                  selectedIndex = 0;
                  setState(() {});
                }),
            IconButton(
                icon: Icon(Icons.error,
                    color: selectedIndex == 1 ? Colors.red : Colors.black),
                onPressed: () {
                  selectedIndex = 1;
                  setState(() {});
                }),
          ],
        ),
      ),
    );
  }
}
